import request from '@/utils/request'
import qs from 'qs'
// 查询物品分类信息列表
export function listCategory(query) {
  return request({
    url: '/itemmanage/category/list',
    method: 'get',
    params: query
  })
}
//查询树状列表
export function treeList() {
  return request({
    url: '/itemmanage/category/treeList',
    method: 'get',
  })
}
// 查询物品分类信息详细
export function getCategory(id) {
  return request({
    url: '/itemmanage/category/' + id,
    method: 'get'
  })
}

// 新增物品分类信息
export function addCategory(data) {
  return request({
    url: '/itemmanage/category',
    method: 'post',
    data: data
  })
}

// 修改物品分类信息
export function updateCategory(data) {
  return request({
    url: '/itemmanage/category',
    method: 'put',
    data: data
  })
}
export function moveCategory(categoryId,moveCategoryId,result) {
  let params = {categoryId,moveCategoryId,result}
  let formParams = qs.stringify(params, {indices: false});

  return request({
    url: '/itemmanage/category/move',
    data: formParams,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参数
    method: 'put'
  })
}

// 删除物品分类信息
export function delCategory(id) {
  return request({
    url: '/itemmanage/category/' + id,
    method: 'delete'
  })
}
